package scuts.macro;
import haxe.macro.Context;
import utest.Assert;

/**
 * ...
 * @author 
 */


class ParseTest 
{

  public function new() 
  {
    
  }
  
  public function test_insert_context_integers_as_expressions_into_array() 
  {
      var s = "[$0, $1]";
      var e = Parse.parse(s, [2, 3]);
      
      var actual = Print.exprStr(e);
      var expected = Print.exprStr(Context.parse("[2,3]", Context.currentPos()));

      Assert.equals(actual, expected);
  }
  
  public function test_context_strings_as_types_into_expr() 
  {
      var s = "function a<T, S>(b:$0<T>, c:S->$1->Void):$2 { return $3;}";
      var e = Parse.parse(s, ['Array', 'Foo', 'Array<String>', ['a']]);
      
      var actual = Print.exprStr(e);
      var expected = Print.exprStr(
        Context.parse("function a<T, S>(b:Array<T>, c:S->Foo->Void):Array<String> { return [\"a\"];}", Context.currentPos()));

      Assert.equals(actual, expected);
  }
  /*
  public function test_var_decl_with_complex_type() 
  {
      var s = "{ var a:$0 = null;}";
      
      var e = Parse.parse(s, ['Array', 'Foo', 'Array<String>', ['a']]);
      
      var actual = Print.exprStr(e);
      var expected = Print.exprStr(
        Context.parse("function a<T, S>(b:Array<T>, c:S->Foo->Void):Array<String> { return [\"a\"];}", Context.currentPos()));

      Assert.equals(actual, expected);
  }
  */
}